﻿

namespace Liger.Web.Javascript
{
    using System;
    using System.Collections.Generic;
    using Liger.Web.Common;

    public interface IJavascriptObjectWriter : IHideObjectMembers
    {
        /// <summary>
        /// 属性名是否首字母大写
        /// </summary>
        bool? PropertyTitleCase { get; set; }

        /// <summary>
        /// 属性名是否首字母小写
        /// </summary>
        bool? PropertyVariableCase { get; set; } 

        IJavascriptObjectWriter WriteEndJQueryOnLoad();
        IJavascriptObjectWriter WriteJQueryOnLoad();

        IJavascriptObjectWriter WriteJQueryPlugin(string ID, string PluginName);
        IJavascriptObjectWriter WriteJQueryPlugin(string ID, string PluginName, string ReturnName);
        IJavascriptObjectWriter WriteEndJQueryPlugin();

        IJavascriptObjectWriter WriteOjbect();
        IJavascriptObjectWriter WriteOjbect(string ReturnName);
        IJavascriptObjectWriter WriteEndOjbect();

        IJavascriptObjectWriter WriteArray();
        IJavascriptObjectWriter WriteArray(string ReturnName);
        IJavascriptObjectWriter WriteEndArray();

        IJavascriptObjectWriter WriteProperty(string name, bool value, bool defaultValue);
        IJavascriptObjectWriter WriteProperty(string name, DateTime value); 
        IJavascriptObjectWriter WriteProperty(string name, IList<string> values);
        IJavascriptObjectWriter WriteProperty(string name, IList<int> values);
        IJavascriptObjectWriter WriteProperty(string name, DateTime? value);
        IJavascriptObjectWriter WriteProperty(string name, Func<string> function);
        IJavascriptObjectWriter WriteProperty(string name, IList<Func<string>> functionList);
        IJavascriptObjectWriter WriteProperty(string name, Action action);
        IJavascriptObjectWriter WriteProperty(string name, bool value);
        IJavascriptObjectWriter WriteProperty(string name, bool? value);
        IJavascriptObjectWriter WriteProperty(string name, int value);
        IJavascriptObjectWriter WriteProperty(string name, int? value);
        IJavascriptObjectWriter WriteProperty(string name, decimal value);
        IJavascriptObjectWriter WriteProperty(string name, decimal? value);
        IJavascriptObjectWriter WriteProperty(string name, double value);
        IJavascriptObjectWriter WriteProperty(string name, double? value); 
        IJavascriptObjectWriter WriteProperty(string name, string value);
        IJavascriptObjectWriter WriteProperty(string keyValuePair);
        IJavascriptObjectWriter WriteProperty(string name, int value, int defaultValue); 
        IJavascriptObjectWriter WritePropertyCollection<T>(string name, IEnumerable<T> value);
        IJavascriptObjectWriter WritePropertyNullableString(string name, string value);
        IJavascriptObjectWriter WritePropertyObject(string name, object value);

        string Output();

        IJavascriptObjectWriter Append(string content);
        IJavascriptObjectWriter AppendLine();
        IJavascriptObjectWriter AppendLine(string content);
    }
}
